package com.shareyi.baseproject.kernel.adapter.spi;

import com.shareyi.baseproject.kernel.adapter.spi.sequence.DefaultSequenceProvider;
import com.shareyi.baseproject.kernel.common.spi.SpiHolder;

/**
 * spi工厂
 *
 * @author david
 * @date 2021-09-01
 */
public class DefaultSpiFactory {

    /**
     * 填装默认的spi服务
     */
    public static void inflateDefaultSpiProvider() {
        SpiHolder spiHolder = SpiHolder.getInstance();

        //默认的序列化工具
        spiHolder.setObjectSerialization(new DefaultObjectSerialization());

        //warning ： 未使用集群防重复功能序列化生成器
        DefaultSequenceProvider longSequenceProvider = new DefaultSequenceProvider();
        longSequenceProvider.setClusterUniqueCheckEnable(false);
        spiHolder.setLongSequenceProvider(longSequenceProvider);
    }
}
